package com.hdd.art.biz.show.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hdd.art.biz.show.entity.ShowroomRule;
import com.hdd.art.biz.show.mapper.ShowroomRuleMapper;
import com.hdd.art.biz.show.service.ShowroomRuleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author fang
 * @since 2021-07-10
 */
@Service
public class ShowroomRuleServiceImpl extends ServiceImpl<ShowroomRuleMapper, ShowroomRule> implements ShowroomRuleService {


    @Override
    public void addRule(ShowroomRule showroomRule) {
        baseMapper.insert(showroomRule);
    }

    @Override
    public void update(ShowroomRule showroomRule) {
        QueryWrapper<ShowroomRule> wrapper = new QueryWrapper<>();
        wrapper.eq("room_id",showroomRule.getRoomId());
        baseMapper.update(showroomRule,wrapper);
    }


    @Override
    public ShowroomRule find(Integer roomId) {
        QueryWrapper<ShowroomRule> wrapper = new QueryWrapper<>();
        wrapper.eq("room_id",roomId);
        return baseMapper.selectOne(wrapper);
    }
}
